package ua.com.globallogic.basecamp.krasnyanskiy.primenumbers;

import java.io.InputStream;
import java.util.Scanner;

public class UserInput {

    private int numberOfThreads;
    private int boundary;
    private InputStream stream;

    public UserInput(InputStream stream) {
        this.stream = stream;
    }

    UserInput scan() throws Exception {
        Scanner scanner = new Scanner(stream);

        try {
            System.out.print("Please enter the number of threads: ");
            numberOfThreads = scanner.nextInt();
            System.out.print("and the boundary: ");
            boundary = scanner.nextInt();
            System.out.println("----------------------------------");
        } finally {
            scanner.close();
        }
        return this;
    }

    int getThreads() {
        return numberOfThreads;
    }

    int getBoundary() {
        return boundary;
    }
}
